<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>后台管理 - 易买网</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/scripts/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/scripts/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/scripts/function.js"></script>
    <script type="text/javascript">
        function changStatu(e,id) {
            if (confirm("你是否要修改订单号为"+id+"的状态"+$(e).val())){
                location.href='${pageContext.request.contextPath}/order/updateOrder?status='+$(e).val()+'${"&"}'+'entityId='+id;
            }else {
                location.href="${pageContext.request.contextPath}/order/toOrder";
            }
        }
    </script>
</head>
<body>
<jsp:include page="top.jsp"/>
<div id="main" class="wrap">
    <jsp:include page="leftbar.jsp"/>
    <div class="main">
        <h2>订单管理</h2>
        <div class="manage">
            <div class="search">
                <form method="post" action="${pageContext.request.contextPath}/order/selectOrder" id="orderForm">
                    订单号：<input type="text" class="text" name="entityId" id="entityId"
                               value="<c:out value="${entityId}"/>"/>
                    <label class="ui-blue"><input type="submit" name="submit"
                                                  value="查询"/>
                    </label>
                </form>
            </div>
            <div class="spacer"></div>

            <table class="list">
                <c:if test="${orders==null || orders.size()==0}">
                    无符合此条件的订单！
                </c:if>
                <c:forEach items="${orders}" var="entrys">
                    <c:if test="${sessionScope.loginUser.euUserId == entrys.EO_USER_ID || (sessionScope.loginUser.euStatus==2)}">
                        <tr>
                            <th class="first w4 c" colspan="2">单号:${entrys.eo_id} 时间:${entrys.EO_CREATE_TIME}</th>
                            <th class="w1 c" colspan="2">状态:
                                <span id="span">
										<select id="status" name="status" <c:if test="${sessionScope.loginUser!=null && (sessionScope.loginUser.euStatus!=2)}">disabled</c:if> onchange='changStatu(this, ${entrys.eo_id});'>
												<option value="1" <c:if test="${entrys.EO_STATUS==1}">selected="selected" </c:if>>待审核</option>
												<option value="2" <c:if test="${entrys.EO_STATUS==2}">selected="selected" </c:if>>审核通过</option>
												<option value="3" <c:if test="${entrys.EO_STATUS==3}">selected="selected" </c:if>>配货</option>
												<option value="4" <c:if test="${entrys.EO_STATUS==4}">selected="selected" </c:if>>发货</option>
										</select>
									<c:if	test="${sessionScope.loginUser!=null && (sessionScope.loginUser.euStatus==1)}">
                                        <c:if test="${entrys.EO_STATUS==4}">
                                            <input  type="button"  value="收货确认" onclick='changStatus(this, ${entrys.eo_id})' />
                                        </c:if>
                                    </c:if>
								</span>
                            </th>
                        </tr>
                        <tr>
                            <td class="first w4 c"><img
                                    src="${pageContext.request.contextPath}/static/files/${entrys.EP_FILE_NAME}" /><a
                                    href="${pageContext.request.contextPath}/product/productView?entityId=${entrys.EP_ID}">${entrys.EP_NAME}</a>
                            </td>
                            <td class="w1 c">${entrys.EP_PRICE}</td>
                            <td class="w1 c">${entrys.EOD_QUANTITY}</td>
                            <td rowspan="<%--${entry.size()}--%>" class="w1 c">总计:${entrys.EO_COST}</td>
                        </tr>
                    </c:if>
                    <%--							<tr>--%>
                    <%--								<td class="first w4 c"><img src="../files/${entrys.value.epFileName}" /><a href="../Product?action=view&entityId=${product.id}">${product.name}</a></td>--%>
                    <%--								<td class="w1 c">${entrys.value.epPrice}</td>--%>
                    <%--								<td class="w1 c">${entrys.value.epStock}</td>--%>
                    <%--							</tr>--%>
                </c:forEach>
                <%--					</c:forEach>--%>
            </table>

            <div class="pager">
                <ul class="clearfix">
                </ul>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">Copyright &copy; 2013 XXX All Rights Reserved.
    京ICP证1000001号
</div>
</body>
</html>
